import Vue from 'vue'
import Vuex from 'vuex'
import getters from './getters'
import app from './modules/app'
import settings from './modules/settings'
import user from './modules/user'
import supplier from "./modules/supplier"
import purchaseInfo from './modules/purchaseInfo'
import vuex from './modules/vuex'
import createPersistedState from "vuex-persistedstate"

Vue.use(Vuex)

const store = new Vuex.Store({
  modules: {
    app,
    settings,
    user,
    supplier,
    purchaseInfo,
    vuex
  },
  plugins: [createPersistedState({
    storage: window.sessionStorage,
    reducer(val) {
      
      return {
      // 只储存state中的tableData
      tableData: val.vuex.tableData
    }
 }
})],
  getters
})

export default store
